/*

Author   : chaos

FileName : fun_phol.cpp

Date     : 10/08/17 03:17:45

*/
#include <iostream>
using namespace std;

int sum(int, int = 1000);

int main(int argc ,char *argv[])
{
    // int sum(int ,int);   // also could define it here

    cout << "  The sum form 1 to 1000 is " << sum (1) << "." << endl;
    return 0;
}


int sum(int under_value,int up_value)
{
    int i ,temp ,total = 0;

    if (up_value < under_value){
        temp =up_value;
        up_value = under_value;
        under_value = temp;
    }

    for (i = under_value;i <= up_value ; i++)
    {
        total += i;
    }
    return total;
}
